/*
 * Comment.java
 *
 * Created on 13 novembre 2007, 16:24
 */
package com.reimscopie ;

import java.util.* ;


/**
 * This class is a comment submited by a client. A comment concerns a single
 * product.
 */
public class Comment extends Value {
  
  // comment content
  private String message ;
  
  // date of commitment
  private Date date ;
  
  // the account corresponing to this comment.
  private Account account ;
  
  
  /**
   * Create a new <code>Comment</code> instance with all attributes. This
   * object has no image in the database.
   *
   * @param message The message submited by the user.
   * @param date The date when the comment was submited.
   * @param account The account corresponding to this comment.
   */
  public Comment(String message,Date date,Account account) {
    
    super() ;
    
    this.message = message ;
    this.date    = date ;
    this.account = account ;
    
  }
  
  
  /**
   * Create a new <code>Comment</code> instance with an image in the database.
   *
   * @param id The comment id in the database.
   * @param message The message submited by the user.
   * @param date The date when the comment was submited.
   * @param account The account corresponding to this comment.
   */
  public Comment(long id,String message,Date date,Account account) {
    
    super(id) ;
    
    this.message = message ;
    this.date    = date ;
    this.account = account ;
    
  }
  
  
  /**
   * Return the message of this comment.
   *
   * @return The message.
   */
  public String getMessage() {
    return message ;
  }
  
  
  /**
   * Return the commitment date of this message.
   *
   * @return The date of the comment.
   */
  public Date getDate() {
    return date ;
  }
  
   /**
   * Return the account corresponding ti this comment.
   *
   * @return The account corresponding to this comment.
   */
  public Account getAccount() {
    return account ;
  }
  

  /**
   * Create a new map with all attributes of this value.
   * 
   * @return A string-string map with the named attributes.
   */
  @Override
  public Map<String,String> toMap() {
    
    Map<String,String> map = new LinkedHashMap<String,String>() ;
    
    map.put("message",message) ;
    map.put("date",date.toString()) ;
    map.put("account",account.toString()) ;
    
    return map ;
    
  }
  
}
